import logging
from queue import Queue
from datetime import datetime


class AppLogger:
    def __init__(self):
        self.log_queue = Queue()
        self._setup_logging()

    def _setup_logging(self):
        logging.basicConfig(
            filename="app.log",
            level=logging.INFO,
            format="%(asctime)s - %(levelname)s - %(message)s"
        )

    def info(self, message):
        self._log("INFO", message)

    def error(self, message):
        self._log("ERROR", message)

    def _log(self, level, message):
        entry = f"[{datetime.now().strftime('%H:%M:%S')}] {level} - {message}"
        self.log_queue.put(entry)
        logging.log(getattr(logging, level), message)